<template>
  <div class="grand-child">
    <h3>我是孙组件</h3>
    <h4>银子：{{ x }}万元</h4>
    <h4>车子：一辆{{ car.brand }}车，价值{{ car.price }}万元</h4>
  </div>
</template>

<script setup lang="ts" name="GrandChild">
//第二个参数是默认值
import { inject } from "vue"
let x = inject('qian', 128)
let car = inject('car', {
  brand: '未知',
  price: 0
})
</script>

<style scoped>
.grand-child {
  background-color: orange;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px black;
}
</style>